package demo3;

import java.util.Random;

public class char11 {
    public static void main(String[] args) {
        //打乱字符串两只方式，substring截取
        //变成字符组
        //键盘输入任意字符串，打乱里面的内容
        String s="abfhs5x";
        Random r=new Random();
        char[]arr=s.toCharArray();
        for (int i = 0; i < arr.length; i++) {
            char c = s.charAt(i);
            int index=r.nextInt(7);
            char temp=arr[i];
            arr[index]=temp;
            arr[i]=arr[index];
        }
        String result=new String(arr);
        System.out.println(result);
    }
}
